package com.gaoyang.controller;

//import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by gaoyang on 2017/6/2.
 */
@Controller
public class ThymeleafController {

//    @ApiOperation(value="测试Thymeleaf", notes="到index首页")
    @RequestMapping(value = "/thymeleaf", method = RequestMethod.GET)
    public ModelAndView index() {
        ModelAndView mav = new ModelAndView();
        // 加入一个属性，用来在模板中读取
        mav.addObject("host", "http://www.gaoyang.com");
        mav.setViewName("index");
        // return模板文件的名称，对应src/main/resources/templates/index.html
        return mav;
    }

    @RequestMapping("/security")
    public ModelAndView hello() {
        ModelAndView mav = new ModelAndView();
        // 加入一个属性，用来在模板中读取
        mav.setViewName("security");
        // return模板文件的名称，对应src/main/resources/templates/index.html
        return mav;
    }
}
